package lesson.controller;

import lesson.entity.NocvGlobalData;
import lesson.service.GlobalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description:
 * @Author: Wanzhen
 * @Date: 2022/6/10-22:03
 */
@Controller
public class GlobalController {

    @Autowired
    private GlobalService globalService;

    //跳转到全球疫情地图
    @RequestMapping("/toGlobal")
    public String toGlobal(){
        return "global";
    }

    //查询疫情数据
    @RequestMapping("/queryGlobal")
    @ResponseBody //返回json实体，在前台的ajax请求才能返回json对象
    public List<NocvGlobalData> queryGlobal(){
        List<NocvGlobalData> list = globalService.list();
        return list;
    }

}
